package com.speedcar.base.i18n;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import javax.annotation.PostConstruct;

@Configuration
@Import(ScI18nConfig.class)
public class ScI18nAutoConfiguration {

    private final MessageSource messageSource;

    @Autowired
    public ScI18nAutoConfiguration(MessageSource messageSource) {
        this.messageSource = messageSource;
    }

    @PostConstruct
    public void init() {
        // 初始化工具类
        ScI18nUtils.setMessageSource(messageSource);
    }
}
